package com.order.manager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.order.manager.Model.UserInfo;
import com.order.manager.Model.other.LoginRequest;
import com.order.manager.Model.other.RestBean;
import com.order.manager.service.UserInfoService;
import com.order.manager.mapper.UserInfoMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 24862
* @description 针对表【user_info】的数据库操作Service实现
* @createDate 2024-03-26 18:27:20
*/
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo>
    implements UserInfoService, IService<UserInfo> {

    @Resource
    UserInfoMapper userInfoMapper;

    @Override
    public Integer getStudentCount(){
        List<UserInfo> userInfos = userInfoMapper.selectList(new QueryWrapper<UserInfo>()
                .eq("role", "student")
                .eq("state", 1)
        );
        userInfos.addAll(userInfoMapper.selectList(new QueryWrapper<UserInfo>()
                .eq("role", "student_sender")
                .eq("state", 1)
        ));
        return userInfos.size();
    }




}




